package com.example.demo.service;


import com.example.demo.entity.Notation;
import com.example.demo.entity.TheoryKnowledge;
import com.example.demo.mapper.TheoryKnowledgeMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TheoryKnowledgeImpl implements TheoryKnowledgeService {

        @Autowired
        private TheoryKnowledgeMapper theoryKnowledgeMapper;

        @Override
        public PageInfo<TheoryKnowledge> findTheoryKnowledgePage(Integer pageNum, Integer pageSize) {
                PageHelper.startPage(pageNum,pageSize);
                List<TheoryKnowledge> lists = theoryKnowledgeMapper.findTheoryKnowledgeAll();
                PageInfo<TheoryKnowledge> pageInfo = new PageInfo<>(lists);
                return pageInfo;
        }

        @Override
        public List<TheoryKnowledge> findTheoryKnowledgeAll() {
                return theoryKnowledgeMapper.findTheoryKnowledgeAll();
        }

        @Override
        public TheoryKnowledge findTheoryKnowledgeById(Integer theoryKnowledgeId) {
                return theoryKnowledgeMapper.findTheoryKnowledgeById(theoryKnowledgeId);
        }


        @Override
        public Integer insertTheoryKnowledge(TheoryKnowledge theoryKnowledge) {
                // 这里可以添加参数校验逻辑
                return theoryKnowledgeMapper.insertTheoryKnowledge(theoryKnowledge);
        }


        @Override
        public Integer updateTheoryKnowledge(TheoryKnowledge theoryKnowledge) {
                // 这里可以添加参数校验逻辑
                return theoryKnowledgeMapper.updateTheoryKnowledge(theoryKnowledge);
        }


        @Override
        public Integer deleteTheoryKnowledge(Integer theoryKnowledgeId) {
                // 这里可以添加参数校验逻辑
                return theoryKnowledgeMapper.deleteTheoryKnowledge(theoryKnowledgeId);
        }


        @Override
        public List<TheoryKnowledge> getHotKnowledges() {
                return theoryKnowledgeMapper.findHotKnowledges();
        }

}